home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_200
/
222_01
/
cc.doc
< prev
next >
Wrap
Text File
|
1980-01-01
|
18KB
|
461 lines
S m a l l - C D o c u m e n t a t i o n
V e r s i o n 2.70 10/30/86
by
F. A. Scacchitti
25 Glenview Lane
Rochester, NY 14609
(716) 482 - 7159
This document is intended to supplement J. E. Hendrix's "The
Small C Handbook" and will only discuss the differences between
this version of Small C and that described in the Manual. It is
recommended the user purchase Hendrix's manual for a more
complete treatment of Small C.
For information regarding the contents and structure of the Small
C library, refer to the file CLIB.DOC and Hendrix's Manual.
This compiler was originally Version 2.1 as obtained from J. E
Hendrix. It includes all of his newsletter fixes/enhancements.
Refer to the file CC.DEF for a complete chronological history of
changes and details regarding modules or functions changed. Also
it is assumed the user is somewhat familiar with the M80/L80
software. The compiler produces an output file of assembly
language pneumonics which must be assembled and linked.
This compiler is a superset of J. E. Hendrix's Version 2.1
compiler, yet still a subset of C as described by Kernigan and
Ritchie in "The C Programming Manual". The following enhancements
have been installed:
2.1 --> 2.2
* - CP/M runtime package and I/O library to optimize size
and speed
* - Global initialization option -i
* - No boot option -n
* - external static Type Specifiers
* - Conditional operator {expr1 ? expr2 : expr3}
2.2 --> 2.3
* - added multiple levels of indirection
eg. **char c; ***int ident; ****var = **c;
2.3 --> 2.4
* - improved multiple levels of indirection to ensure
appropriate element is stored or retrieved
2.4 --> 2.5
* - added arrays of pointers
eg. char *argv[]; int **i[20]; *i[2] = 22;
* - added hex and octal constants
eg. 0x1a, 0XFA, 03777, 00017
2.5 --> 2.6
* - added global multidimensional arrays
eg. char arc[5][5]; int i[3][4][5]; var=i[2][0][3];
2.6 --> 2.7 (Released 10/86 for public consumption)
* - added nested includes
* - new runtime library (rdrtl.rel) for compiler and/or
redirected output
* - new i/o library (clib.rel)
Planned 2.7 --> 2.8 (In final stages)
* - install floating point (float and double)
(only for Z80 microprocessors)
* - allow function definition syntax
* - add compiler error tracker/counter
Planned 2.8 --> 2.9 (schemes developed)
* - add typedefs, sizeof, unsigned integers
Planned 2.9 --> 3.0 (matter of parsing) (2nd quarter '87)
* - allow auto, register, short declarations
(This will be a release version and the final one
for CP/M)
Planned CP/M 3.0 --> MSDOS 3.0 (3rd quarter '87)
* - using J. E. MSDOS version upgrade to my version 3.0
(will contain floating point, if I can obtain a good
package for MSDOS)
Planned MSDOS 3.0 --> MSDOS 4.0 (not started) (4th quarter '87)
* - add longs, unions and structures
This is an aggressive schedule (slips are possible), but at
completion should be a full implementation of C. If anyone has
any suggestions or has already accomplished that which remains
undone here, don't hesitate to contact me. I have no qualms about
collaborating to finish the job or optimize compiler operation.
FEATURES and ENHANCEMENTS
* - Global initialization option -i
This feature decreases compilation time, especially when large
arrays are declared globally. Most versions of the compiler (at
least the ones I've seen), by default, initialize all global
variables to zero by generating either DB 0 or DW 0. Arrays are
initialized via DB 0, 0, 0, 0, 0, 0, . . . . . . . . . .
This adds significantly to compile time if the user has declared
large global arrays. The compiler now issues a DS n thus
allocating n bytes of uninitialized memory. If the -i switch is
used, memory will be initialized to zeroes as before. As a
furthur example, the Eratosthenes Prime Number Sieve takes 80
seconds to compile when the -i switch is used but only 17 seconds
if it isn't. An additional 55 seconds is required with each for
assembly and linking.
* - No boot option -n
This feature allows rapid return to the CP/M prompt on program
completion at a cost of 800h bytes of code space. It is used in
conjunction with the runtime package in the C library (CLIB.REL).
If the the -n switch is used and the program contains a main()
function, DB ZZZCCP 1 will be generated by the compiler prior to
the END statement. If it isn't specified the compiler generates
DB ZZZCCP 0. The global variable ZZZCCP determines where the
stack should be placed and the return path to CP/M. In short, if
the -n option is used the stack is placed at the base of the CCP
and the program returns to CP/M via a return instruction. If the
-n option isn't specified the stack is placed at the base of the
BDOS and return is performed via a warm boot. Refer to CLIB.DOC
and ULINK.MAC for details regarding operation of this feature.
This feature is NOT recommended for use with programs performing
disk i/o, but was intended primarily for non-disk utilities.
* - external static Type Specifiers
Global variables are more rapidly accessed (both fetching and
storing) and require less code to access than local variables.
Refer to Chapter 19 of Hendrix's manual for a complete
explanation. Most Small C compilers make all global declarations
public. This obviously presents a problem (especially for the
variables c and i) in taking full advantage of this feature. The
static type specifier implies that the variable should be memory
resident, yet known only to the module it is compiled in. This is
accomplished simply by generating a single colon for types
specified as static and the original double colon for those that
are not. This results in variables that are local only to the
file in which they are compiled. It is ideal for non-recursive
library functions.
* - Conditional operator {expr1 ? expr2 : expr3}
This is just another enhancement to bring Small C closer to Big
C. This operator is described quite thoroughly in Kernigan &
Ritchie's "The C Programming Language" and works as specified.
The user should try the examples in thier manual. The code
generated by this operator is almost exactly the same as an if-
else statement, however if does lead to more succinct and elegant
code at the source level and can be used inside statements where
if - else fears to tread.
* - added multiple levels of indirection
This was always a sore spot with me. Now your program can use a
standard argc, argv syntax. (int argc; char **argv;) It also
generates more efficient and shorter code since additional
argument assignments aren't necessary when accessing extended
levels of a pointer.
* - added arrays of pointers
One more step toward standardization with full C. The programmer
may use char **argv; or char *argv[]; and/or retrieve/store as
specified by K & R.
* - added hex and octal constants
Works as described by K & R. NO longer any need for that decimal-
hexadecimal-octal calculator on the shelf. (Well at least not for
figuring contants and addresses for your small c program.)
* - added global multidimensional arrays
Some programs almost demand this capability. However, there is
some overhead involved in using multi-dimmed arrays and the code
generated can be larger than if multiple single dimensione